<template>
   <div class="container2">
    <h2>二兄弟</h2>
    <div>{{msg}}</div>
   </div>
</template>

<script>
//钩子函数：到了指定的实际自己会调用的称为钩子函数:created:组件在创建完毕之后会调用
import pubsub from 'pubsub-js'
export default {
  data(){
    return{
        msg:''
    }
  },
  created(){
    pubsub.subscribe('make',(arg1,arg2)=>{
      console.log('arg1',arg1);
      console.log('arg2',arg2);
      this.msg=arg2
    })
   
  }
}
</script>

<style>
    .container2{
        flex-grow: 1;
        height: 100vh;
        background-color: springgreen;
    }
</style>